import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

// 调拨申请表
@Entity({ name: 'allocate' })
export class Allocate extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 调拨申请编号
  @PrimaryColumn({
    type: 'varchar',
    name: 'allocateCode',
  })
  allocateCode: string

  // 申请人
  @Column({
    type: 'varchar',
    name: 'receivePerson',
  })
  receivePerson: string

  // 申请人id
  @Column({
    type: 'int',
    name: 'receivePersonId',
  })
  receivePersonId: number

  // 申请部门
  @Column({
    type: 'varchar',
    name: 'receiveBranch',
    nullable: true,
  })
  receiveBranch: string

  // 申请部门id
  @Column({
    type: 'int',
    name: 'receiveBranchId',
    nullable: true,
  })
  receiveBranchId: number

  // 调拨名称
  @Column({
    type: 'varchar',
    name: 'allocateName',
  })
  allocateName: string

  // 调拨类型 0 调入 1 调出
  // @Column({
  //   type: 'varchar',
  //   name: 'allocateType',
  // })
  // allocateType: string

  // 调入部门
  @Column({
    type: 'varchar',
    name: 'allocateInBranch',
  })
  allocateInBranch: string

  // 调入部门id
  @Column({
    type: 'int',
    name: 'allocateInBranchId',
    nullable: true,
  })
  allocateInBranchId: number

  // 调出部门
  @Column({
    type: 'varchar',
    name: 'allocateOutBranch',
  })
  allocateOutBranch: string

  // 调出部门id
  @Column({
    type: 'int',
    name: 'allocateOutBranchId',
    nullable: true,
  })
  allocateOutBranchId: number

  // 调入状态 0 进行中 1 驳回 2 同意
  @Column({
    type: 'varchar',
    name: 'allocateInStatus',
  })
  allocateInStatus: string

  // 调出状态 0 进行中 1 驳回 2 同意
  @Column({
    type: 'varchar',
    name: 'allocateOutStatus',
  })
  allocateOutStatus: string

  // 调拨资产编码
  @Column({
    type: 'varchar',
    name: 'assetCode',
  })
  assetCode: string

  // 调入仓库id
  @Column({
    type: 'int',
    name: 'warehouseId',
  })
  warehouseId: number

  // 申请日期
  @Column({
    type: 'varchar',
    name: 'receiveDate',
  })
  receiveDate: string

  // 申请原因
  @Column({
    type: 'varchar',
    name: 'receiveReason',
  })
  receiveReason: string

  // 备注
  @Column({
    type: 'varchar',
    name: 'remark',
    nullable: true,
  })
  remark: string

  // 调出批复
  @Column({
    type: 'varchar',
    name: 'outReason',
    nullable: true,
  })
  outReason: string

  // 调入批复
  @Column({
    type: 'varchar',
    name: 'inReason',
    nullable: true,
  })
  inReason: string

  // 调拨日期
  @Column({
    type: 'varchar',
    name: 'allocateDate',
    nullable: true,
  })
  allocateDate: string

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean
}
